/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.action;

import com.myapp.dao.DaoDocumento;
import com.myapp.dao.DaoFacade;
import com.myapp.model.Documento;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.HibernateException;

/**
 *
 * @author elio
 */
public class ListarDocumentosAction extends org.apache.struts.action.Action {

    /* forward name="success" path="" */
    private static final String SUCCESS = "success";
  
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        List docs= null;
        DaoFacade dao = DaoDocumento.getInstance();
        //try{
            docs = dao.carregarTudoOrdenado(Documento.class, "id");
            request.setAttribute("docsList", docs);   
        return mapping.findForward(SUCCESS);
      
    }
}
